<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="layout/template.xhtml">

<ui:define name="body">

	<h2 class="title"><a href="#">Gerenciar Empresas</a></h2><br/>

            <h:form id="empresaForm">
            
	           <h:panelGrid columns="1">
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Razão Social:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscRazaoSocial}"
	            			required="true"
	            			maxlength="200"
	            			onkeydown="Mascara(this,Maiusculo)"
							onkeyup="Mascara(this,Maiusculo)"
	            			style="width: 300px;"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Nome fantasia:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscNomeFantasia}"
	            			required="false"
	            			maxlength="200"
	            			onkeydown="Mascara(this,Maiusculo)"
							onkeyup="Mascara(this,Maiusculo)"
	            			style="width: 300px;"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">CNPJ:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscCnpj}"
	            			required="true"
	            			maxlength="18"
	            			converter="conversorCnpj"
	            			onkeydown="Mascara(this,Cnpj)"
							onkeyup="Mascara(this,Cnpj)"
	            			style="width: 200px;"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Telefone 1:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscTelefone1}"
	            			required="true"
	            			maxlength="14"
	            			style="width: 200px;"
	            			onkeydown="Mascara(this,Telefone);"
	            			onkeyup="Mascara(this,Telefone);"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Telefone 2:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscTelefone2}"
	            			required="false"
	            			maxlength="14"
	            			style="width: 200px;"
	            			onkeydown="Mascara(this,Telefone);"
	            			onkeyup="Mascara(this,Telefone);"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Data de validade:</ui:define>
	            		<rich:calendar value="#{manterEmpresaController.empresaEdicao.dtaValidade}"
	            			datePattern="dd/MM/yyyy"
	            			required="true"
	            			enableManualInput="true"
	            			oninputkeydown="Mascara(this,Data)"
	            			oninputkeyup="Mascara(this,Data)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Nome do responsável:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscNomeResponsavel}" 
	            			maxlength="200"
	            			required="true"
	            			style="width: 300px;"
	            			onkeydown="Mascara(this,Maiusculo)"
	            			onkeyup="Mascara(this,Maiusculo)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">CPF do responsável:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscCpfResponsavel}" 
	            			maxlength="14"
	            			required="true"
	            			converter="conversorCPF"
	            			style="width: 100px;"
	            			onkeydown="Mascara(this,Cpf)"
	            			onkeyup="Mascara(this,Cpf)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">E-mail:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscEmail}" 
	            			maxlength="200"
	            			required="true"
	            			style="width: 300px;"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Endereço:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscEndereco}" 
	            			maxlength="200"
	            			required="false"
	            			style="width: 300px;"
	            			onkeydown="Mascara(this,Maiusculo)"
	            			onkeyup="Mascara(this,Maiusculo)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Cidade:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscCidade}" 
	            			maxlength="100"
	            			required="true"
	            			style="width: 200px;"
	            			onkeydown="Mascara(this,Maiusculo)"
	            			onkeyup="Mascara(this,Maiusculo)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">UF:</ui:define>
	            		<h:selectOneMenu value="#{manterEmpresaController.empresaEdicao.dscUf}"
	            			required="true">
	            			<f:selectItems value="#{manterEmpresaController.listaUfs}"/>
	            		</h:selectOneMenu>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">CEP:</ui:define>
	            		<h:inputText value="#{manterEmpresaController.empresaEdicao.dscCep}" 
	            			maxlength="9"
	            			required="false"
	            			style="width: 100px;"
	            			converter="conversorCEP"
	            			onkeydown="Mascara(this,Cep)"
	            			onkeyup="Mascara(this,Cep)"/>
	            	</s:decorate>
	            	
	            	<s:decorate template="/layout/edit.xhtml">
	            		<ui:define name="label">Plano:</ui:define>
	            		<h:selectOneMenu value="#{manterEmpresaController.empresaEdicao.tpoPlano}">
	            			<f:selectItem itemLabel="MENSAL" itemValue="MENSAL"/>
	            			<f:selectItem itemLabel="TRIMESTRAL" itemValue="TRIMESTRAL"/>
	            			<f:selectItem itemLabel="SEMESTRAL" itemValue="SEMESTRAL"/>
	            			<f:selectItem itemLabel="ANUAL" itemValue="ANUAL"/>
	            		</h:selectOneMenu>
	            	</s:decorate>
	            </h:panelGrid>
	            <br/>
	            <div class="actionButtons">
		        	<h:commandButton id="submit" value="Salvar" action="#{manterEmpresaController.salvar}"
		            	onclick="javascript:if(!confirm('Tem certeza que deseja salvar?'))return false;"/>
		            	
		            <a:commandButton id="cancel" value="Cancelar" 
				        		action="#{manterEmpresaController.cancelar}" 
				        		ajaxSingle="true"
				        		reRender="empresaForm"/>
		        </div>
				<br/>
				
			</h:form>
			
 </ui:define>
</ui:composition>
